/**
 * <vendor>
 *  Copyright 2009 Quanben Tech.
 * </vendor>
 */

namespace QSharp.String.Rex
{
    public struct WrappedUint : IContinuous<WrappedUint>
    {
        public uint Value;

        public WrappedUint(uint v) { Value = v; }

        public int CompareTo(WrappedUint that)
        {
            return Value.CompareTo(that.Value);
        }

        public bool IsAdjacentTo(WrappedUint that)
        {
            return IsSucceeding(that) || IsPreceding(that);
        }

        public bool IsSucceeding(WrappedUint that)
        {
            return Value == that.Value + 1;
        }

        public bool IsPreceding(WrappedUint that)
        {
            return Value + 1 == that.Value;
        }

        public static implicit operator WrappedUint(uint v)
        {
            return new WrappedUint(v);
        }

        public static implicit operator uint(WrappedUint v)
        {
            return v.Value;
        }

        public override string ToString()
        {
            return Value.ToString();
        }
    }   /* struct WrappedUint */

}   /* namespace QSharp.String.Rex */
